package org.itli.jnsocket.Mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.itli.jnsocket.Pojo.GoodsCategory;

import java.util.List;

@Mapper
public interface GoodsMapper {

    @Select("select id,pid,category_name from jn_wms_goods_category;")
    List<GoodsCategory> AllCategory();

    @Insert("INSERT INTO jn_wms_goods_category (" +
            "    pid," +
            "    category_name," +
            "    order_num," +
            "    create_by," +
            "update_time"+
            ") VALUES (" +
            "    null," +
            "    #{category_name}," +
            "    #{order_num}," +
            "    #{create_by}," +
            "    NOW()" +
            ");")
    int AddCategory(String category_name,String order_num,String create_by);

    @Insert("INSERT INTO jn_wms_goods_category (" +
            "    pid," +
            "    category_name," +
            "    order_num," +
            "    create_by," +
            "update_time"+
            ") VALUES (" +
            "    #{pid}," +
            "    #{category_name}," +
            "    #{order_num}," +
            "    #{create_by}," +
            "    NOW()" +
            ");")
    int AddSubCategory(String category_name,String order_num,String create_by,String pid);

    @Delete("delete from jn_wms_goods_category where id = #{id}")
    void DeleteCategory(String id);

}
